package com.x.service.entity.map;

import com.x.service.entity.BookList;
import com.x.service.entity.BookListsBean;
import com.x.zssqservice.bean.SearchDetail;

import java.util.ArrayList;

/**
 * Created by H on 18/5/9.
 */

public class SearchDetailToBookList implements IMap<SearchDetail, BookList> {
    @Override
    public BookList map(SearchDetail searchDetail) {
        BookList bookList = new BookList();
        bookList.books = new ArrayList<>();
        bookList.ok = searchDetail.ok;
        for (SearchDetail.SearchBooks searchBooks : searchDetail.books) {
            BookListsBean bookListsBean = new BookListsBean();
            bookListsBean._id = searchBooks._id;
            bookListsBean.title = searchBooks.title;
            bookListsBean.author = searchBooks.author;
            bookListsBean.cover = IMG_BASE_URL + searchBooks.cover;
            bookListsBean.shortIntro = searchBooks.shortIntro;
            bookListsBean.lastChapter = searchBooks.lastChapter;
            bookListsBean.updated = searchBooks.updated;
            bookListsBean.latelyFollower = searchBooks.latelyFollower;
            bookList.books.add(bookListsBean);
        }
        return bookList;
    }
}
